﻿/*
 * Class  :  HTML
 * Author : Chung Thành Phước 
 * Create Date: 18/12/2014
 * Update date: 18-12-2014 by Chung Thành Phước 
 * Reference: Ext.Net,System.Globalization
 */

using Ext.Net;
using System.Globalization;
namespace HTML
{
    public class clsFormat
    {
        #region[Messenbox]
        public static void Alert_WARNING(string Title, string Message)
        {
            X.Msg.Show(new MessageBoxConfig
            {
                Title = Title,
                Message = Message,
                Buttons = MessageBox.Button.OK,
                Icon = (MessageBox.Icon.WARNING),
            });
        }
        public static void Alert_ERROR(string Title, string Message)
        {
            X.Msg.Show(new MessageBoxConfig
            {
                Title = Title,
                Message = Message,
                Buttons = MessageBox.Button.OK,
                Icon = (MessageBox.Icon.ERROR),
            });
        }
        public static void Alert_INFO(string Title, string Message)
        {
            X.Msg.Show(new MessageBoxConfig
            {
                Title = Title,
                Message = Message,
                Buttons = MessageBox.Button.OK,
                Icon = (MessageBox.Icon.INFO),
            });
        }
        public static void DoConfirm(string Title, string Message)
        {
            X.Msg.Confirm(Title, Message, new MessageBoxButtonsConfig
            {
                Yes = new MessageBoxButtonConfig
                {
                    Text = "Đồng ý"
                },
                No = new MessageBoxButtonConfig
                {
                    Text = "Bỏ qua"
                }
            }).Show();
        }
        #endregion

        #region[CraateControl]
        public static string CreateWindow(string Content)
        {
            var win = new Window
            {
                ID = "WindowErrorMessenger",
                Title = "Lỗi",
                Height = 185,
                Width = 350,
                Maximizable = false,
                Maximized = true,
                AutoScroll = true,
                Region = Region.Center,
                BodyPadding = 5,
                Resizable = true,
                AutoShow = true,
                Modal = true,
                CloseAction = CloseAction.Destroy,
                Html = Content,
            };
            win.Render();
            return string.Empty;
        }
        #endregion

        #region[Convert-Char]
        public static string ToTitleCase(string input)
        {
            TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo;
            return UsaTextInfo.ToTitleCase(input);
        }
        #endregion

        #region[Notification]
        public static void Notification(Icon Icon,string Title, string Conntent)
        {
            Ext.Net.Notification.Show(new NotificationConfig
            {
                Icon = Icon,
                CloseVisible = true,
                AutoHide = false,
                Title = Title,
                Html = Conntent
            });
        }
        #endregion
    }
}
